package lab03.test03;

import java.io.*;

/**
 * Created by JAVA on 2017/12/13.
 */
public class Test03 {
    public static void main(String args[]) {
        File file = new File("E:/", "test.txt");
        byte b[] = "Beijing 欢迎你！ ".getBytes();
        try {
            FileOutputStream out = new FileOutputStream(file);
            out.write(b);
            out.close();
            FileInputStream in = new FileInputStream(file);
            int n = 0;
            while ((n = in.read(b, 0, 2)) != -1) {
                String str = new String(b, 0, n);
                System.out.print(str);
            }
            FileWriter writer = new FileWriter("E:/test.txt", true);
            writer.write("我的学号是：你自己的学号 ");
            writer.close();
            n = 0;
            while ((n = in.read(b, 0, 2)) != -1) {
                String str = new String(b, 0, n);
                System.out.print(str);
            }
        } catch (IOException e) {
            System.out.print(e);
        }
    }
}
